<template>
  <div class="container">
    <!-- 调用多次组件，且都在标签内添加内容传递 -->
    <Category title="美食">
      <!-- 具名插槽，调用时需指定插槽名称 -->
      <img
        slot="center"
        src="https://s3.ax1x.com/2021/01/16/srJlq0.jpg"
        alt=""
      />
      <a class="foot" slot="footer" href="http://www.atguigu.com">更多美食</a>
    </Category>

    <Category title="游戏">
      <ul slot="center">
        <li v-for="(data, index) in games" :key="index">
          {{ data }}
        </li>
      </ul>
      <!-- 如果往同一个插槽放多次，内容会追加 -->
      <div class="foot" slot="footer">
        <a slot="footer" href="http://www.atguigu.com">单机游戏</a>
        <a slot="footer" href="http://www.atguigu.com">网络游戏</a>
      </div>
    </Category>

    <Category title="电影">
      <video
        slot="center"
        controls
        src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
      ></video>
      <!-- 添加多个标签，指定插槽的代码会有重复，可以在外面再包一个template，然后指定插槽slot="footer" -->
      <!-- 此时，就可以使用另一种最新的具名插槽写法  :后是插槽名 -->
      <template v-slot:footer>
        <div class="foot">
          <a href="http://www.atguigu.com">经典</a>
          <a href="http://www.atguigu.com">热门</a>
          <a href="http://www.atguigu.com">推荐</a>
        </div>
        <h4>欢迎前来观影</h4>
      </template>
    </Category>
  </div>
</template>

<script>
import Category from "./components/Category.vue";

export default {
  name: "App",
  components: {
    Category,
  },
  data() {
    return {
      foods: ["火锅", "烧烤", "小龙虾", "牛排"],
      games: ["红色警戒", "穿越火线", "劲舞团", "超级玛丽"],
      films: ["《教父》", "《拆弹专家》", "《哪吒》", "《尚硅谷》"],
    };
  },
};
</script>

<style scoped>
.container,
.foot {
  display: flex;
  justify-content: space-around;
}
h4 {
  text-align: center;
}
</style>